package 笔试;

import java.util.Scanner;

public class 字符串删除 {
    public static boolean[] flag;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();


        while(isCom(s)) {
            for(int i = 0; i < s.length(); i++) {
                if(i+1 < s.length() && i+2 < s.length()){
                    if(s.charAt(i) == s.charAt(i+1) && s.charAt(i) == s.charAt(i+2)){
                        String s1 = s.substring(0, i);
                        String s2 = s.substring(i+3, s.length());
                        s = s1+s2;
                    }
                }
            }
        }
        System.out.println(s);
    }

    public static boolean isCom(String sb) {
        if(sb.length() < 3) {
            return false;
        }
        char[] arr = sb.toCharArray();
        for(int i = 0; i < sb.length(); i++) {
            if(i+1 < sb.length() && i+2 < sb.length()) {
                if(arr[i] == arr[i+1] && arr[i] == arr[i+2]) {
                    return true;
                }
            }
        }
        return false;
    }
}
